#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}

ll qmi(ll a, ll b)
{
    ll res = 1;
    while(b)
    {
        res = res * a % mod;
        b >>= 1;
        a = a * a % mod;
    }
    return res;
}

void solve()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n - 2; i++)
    {
        a[i + 1] -= a[i] * 2;
        a[i + 2] -=a[i];
        if(a[i + 1] < 0 || a[i + 2] < 0)
        {
            cout << "NO" << endl;
            return;
        }
    }
    if(a[n - 1] == 0 && a[n - 2] == 0)
    {
        cout << "YES" << endl;
    }
    else cout << "NO" << endl;
}

int main()
{
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}